﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;
using System.Collections;

/// <summary>
///GetFiles 的摘要说明
/// </summary>
public class GetFiles
{
    public static FileInfo[] Get(string path)
	{
        try
        {
            DirectoryInfo di = new DirectoryInfo(path);
            FileInfo[] files = di.GetFiles();
            FileComparer fc = new FileComparer();
            Array.Sort(files, fc);
            return files;
        }
        catch
        {
            return null;
        }
	}
}
public class FileComparer : IComparer
{
    int IComparer.Compare(Object o1, Object o2)
    {
        FileInfo fi1 = o1 as FileInfo;
        FileInfo fi2 = o2 as FileInfo;
        return fi2.CreationTime.CompareTo(fi1.CreationTime);
    }
}